<template>
      <el-menu
        :style="{width:isCollapse ? '64px' : '230px'}"
        active-text-color="#ffd04b"
        background-color="#545c64"
        class="el-menu-vertical"
        default-active="2"
        text-color="#fff"
        :collapse="isCollapse"
        @open="handleOpen"
        @close="handleClose"
      >
       <p class="logo-lg">{{ isCollapse?'陪审':'DIDI陪诊' }}</p>
       <tree-menu :menuData="menuData" :index="1"></tree-menu>
      </el-menu>
</template>
<script setup>

import TreeMenu from './treeMenu.vue'
import {useRouter} from 'vue-router'
import { reactive,computed,ref} from 'vue'

import { useStore } from 'vuex'
const store = useStore()
const router = useRouter()
const isCollapse = computed(()=> store.state.menu.isCollapsed)
// const isCollapse = ref(store.state.menu.isCollapsed)

const menuData = reactive(router.options.routes[0].children || [])

const handleOpen = (key, keyPath) => {
  console.log(key, keyPath)
}
const handleClose = (key, keyPath) => {
  console.log(key, keyPath)
}

</script>
<style lang="scss" scoped>
.el-menu-vertical{
  height: 100%;
}
.logo-lg{
  margin:0 0 0 0;
  color: #fff;
  font-size: 20px;
  height:30px;
  line-height:30px;
  text-align: center;
  padding:10px 0;
}
</style>